'use strict'
import Vue from 'vue'
//引入第三方插件
import VueRouter from 'vue-router' //路由
/*import '../../libs/rem.js'*/
import Vant from 'vant'
import 'vant/lib/index.css'
import axios from 'axios'
//引入自己的文件
import App from './App.vue'
import home from './compoments/home/home.vue'
import found from './compoments/home/found.vue'
import order from './compoments/home/order.vue'
import mine from './compoments/home/mine.vue'
import input from './compoments/home/input.vue'
import search from './compoments/home/search.vue'
import gird from './compoments/home/gird.vue'
import listFood from './compoments/home/food/list.vue'
import listDetail from './compoments/home/food/listDetail.vue'
import foodDetail from './compoments/home/food/foodDetail.vue'

//定义全局组件或过滤器
Vue.component('inputAPP', input)
Vue.component('girdApp', gird)
Vue.component('listDetail', listDetail)
//安装插件
Vue.use(VueRouter)
Vue.use(Vant)

//挂载原型
Vue.prototype.$axios = axios
//动态请求地址
axios.defaults.baseURL = '/api'
//阻止启动生产消息
Vue.config.productionTip = false
//默认配置

//创建对象并配置路由
let router = new VueRouter({
  routes: [
    //配置路由规则
    {path: '/', redirect: {name: 'home'}},//重定向，设置主页
    {name: 'home', path: '/home', component: home},//首页
    {name: 'found', path: '/found', component: found},//发现
    {name: 'order', path: '/order', component: order},//订单
    {name: 'mine', path: '/mine', component: mine},//我的
    {name: 'search', path: '/search', component: search},//搜索页面
    {name: 'listFood1', path: '/food/list1', component: listFood},//美食列表
    {name: 'listFood2', path: '/food/list2', component: listFood},//美食列表
    {name: 'foodDetail', path: '/food/detail', component: foodDetail}
  ]
})

//创建Vue实例
new Vue({
  el: '#App',
  router,
  render: c => c(App)//render创建文档，因为vue是虚拟文档，template还需要编译，render免去了编译的过程
})


